<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
body {
  min-width:357px;
  overflow-x:hidden;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Spell The Number</title>
<script type="text/javascript" src="toword.js"></script>
<script type="text/javascript" src="toroman.js"></script>
</head>
<body>
<form name="test">
	<input type="text" name="inum" value="" size="18">
	<br><br>
	<button type="button" onclick="test.rnum.value = toWords(test.inum.value);">To Words<br/>(19 -&gt; nineteen)</button>
	<button type="button" onclick="test.rnum.value = toRoman(test.inum.value,1);">Roman Classical<br/>(19 -&gt; XIX)</button>
	<button type="button" onclick="test.rnum.value = toRoman(test.inum.value,0);">Roman Original<br/>(19 -&gt; XVIIII)</button>
	<br><br><textarea name="rnum" cols="40" rows="5"></textarea>
</form>
<script>
function onSelection(text) {
	var patt=/\d+/;
	test.inum.value = patt.exec(text); 
} 
chrome.extension.getBackgroundPage().getSelection(onSelection); 
</script>
</body>
</html>